package cn.thornbird.orgsync.repository;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface BaseRepository<T> {

    T findFirstById(String id);

    @Modifying
    @Query("update #{#entityName} e set e.deletedAt = CURRENT_TIMESTAMP where e.id = ?1")
    void logicDelete(String id);

    @Modifying
    @Query("delete from #{#entityName} e where e.id = ?1")
    void delete(String id);

}
